package chatGUI;

import java.io.File;
import java.util.ArrayList;

import javax.swing.JList;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;

import people.User;

/**
 * <b>Project ChatSystemG2 - INSA 4INFOA1 - 2013/2014</b>
 * <P>
 * <i>Package  chatGUI</i> <br>
 * FromUser is an interface. <br>
 * It represents the messages from the client to the chat system. <br>
 *
 * @author Sergio Gonzalez - Marie-Charlotte Bideaud
 */

public interface FromUser {
	
	/**
	 * When the local user presses the "connect" button
	 * 
	 * @param username : String 
	 */
	public void clickConnectButton (String username) ; 
	
	/**
	 * When the local user presses the "disconnect" button or closes the chat window
	 */
	public void clickDisconnectButton () ;
	
	/**
	 * When the local user presses the "start chat" button after selected user in the userslist
	 * 
	 * @param firstUser : User
	 * @param tabList : ArrayList<ChatTab>
	 * @param tabbedPane : JTabbedPane 
	 * 
	 * @return ArrayList<ChatTab>
	 */
	public ArrayList<ChatTab> clickStartChatButton (User firstUser, ArrayList<ChatTab> tabList, JTabbedPane tabbedPane) ;
	
	/**
	 * When the local user presses the "send file" button
	 * 
	 * @param user : User
	 * @param file : File 
	 */
	public void clickSendFile (File file, User user) ;
	
	/**
	 * When the local presses the "send text" button or presses "Enter"  
	 * 
	 * @param text : String
	 * @param user : User
	 * @param textArea : JTextArea
	 */
	public void clickSendMessageButton (String text, User user, JTextArea textArea) ;
	
	/**
	 * Method to check if a correct username has been typed (if the field is not empty)
	 * 
	 * @param username : String 
	 */
	public void setUsername (String username) ;
	
	/**
	 * When the local user selects a user in the userslist
	 * 
	 * @param list : Jlist
	 * 
	 * @return boolean
	 */
	public boolean selectUsers (JList list) ;
	
	/**
	 * When a message is sent or received, it is displayed in the corresponding chat tab
	 * 
	 * @param user : User
	 * @param textArea : JTextArea 
	 */
	public void setMessage (User user, JTextArea textArea) ;
	
	/**
	 * When the local user selects a user or a group of users, a new tab is created and displayed
	 * 
	 * @param firstUser : User
	 * @param tabbedPane : JTabbedPane 
	 * @param tabList : ArrayList<ChatTab>
	 * 
	 * @return ArrayList<ChatTab>
	 */
	public ArrayList<ChatTab> setChatWindow (User firstUser, JTabbedPane tabbedPane, ArrayList<ChatTab> tabList) ;
	
	/**
	 * When the local user answers a file request 
	 * 
	 * @param user : User
	 * @param answer : boolean
	 */
	public void answerFile (User user, boolean answer) ;

}
